package com.neusoft.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.neusoft.mapper.BookshelfMapperCustom;
import com.neusoft.model.AppointmentsModel;
import com.neusoft.model.entity.AppointmentExample;
import com.neusoft.model.entity.Bookshelf;
import com.neusoft.model.entity.BookshelfExample;
import com.neusoft.service.BookshelfService;


@Service
public class BookshelfServiceImpl implements BookshelfService{
	@Autowired
	private BookshelfMapperCustom bookshelfMapper;
	
	@Override
	public List<Bookshelf> findBooksByActiveId(String id){
		return bookshelfMapper.findBookshelfByUserId(id);
	}
	
//	BookshelfModel  findAppointmentByUserID(String id);
	@Override
	public void insertBookshelf(Bookshelf bookshelf){
		bookshelfMapper.insert(bookshelf);
	}
	
	@Override
	public void deleteBookshelf(int book_id,String user_id){
//		bookshelfMapper.deleteByExample(example)
		
		BookshelfExample be=new BookshelfExample();
		BookshelfExample.Criteria bec=be.createCriteria();
		 
		bec.andBookIdEqualTo(book_id);
		bec.andIdEqualTo(user_id);
		
		bookshelfMapper.deleteByExample(be);
		 
	}
}
